import Vuex from 'vuex'
import Vue from 'vue'
Vue.use(Vuex)
import {
    router
} from './module/router'

// 这是新加的测试模块
import {
    test
} from './module/test'
export default new Vuex.Store({
    modules: {
        router: router,
        // 引用新加的测试模块
        test: test
    },

    state: {
        cardText: `这是卡片bottom3`,
        cardTextData: `这是卡片bottom3Data`,
        userInfo: null
    },
    mutations: {
        changeText(state, value) {
            state.cardText = value
        },
        changeTextData(state, value) {
            state.cardTextData = value
        },
        test(state) {
            // 变更状态
            console.log(`全局test`)
        },
        getInfoData(state, value) {
            state.userInfo = value;
            let data = JSON.stringify(data)
            localStorage.setItem(`userInfo`, data)
            console.log(`store已经获取到`, state.userInfo)
        }
    }
})
